/*
 * Created on 2009-12-20
 *
 * TODO To change the template for this generated file go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
package com.qdev.apps.izh.service.impl;

import java.util.List;

import com.qdev.apps.core.service.AbstractService;
import com.qdev.apps.izh.domain.MemberAccount;
import com.qdev.apps.izh.service.MemberService;

/**
 * @author seal
 * 
 * TODO To change the template for this generated type comment go to Window -
 * Preferences - Java - Code Style - Code Templates
 */
public class MemberServiceImpl extends AbstractService implements MemberService {

	public void updategMemberAccount(MemberAccount ma) {
		this.update(ma);

	}

	public MemberAccount findMaById(Long memId) {

		return (MemberAccount) this.loadById(MemberAccount.class, memId);
	}

	public MemberAccount findMaByEmail(String email) {
		String hql = "from MemberAccount m where m.email=?";
		List list = this.getHibernateTemplate().find(hql,
				new Object[] { email });
		if(list!=null && list.size()>0){
			return (MemberAccount) list.get(0);
		}
		return null;
	}

	public void addMemberAccount(MemberAccount ma) {
		this.create(ma);
	}

}
